package com.tree.common.mail.service.impl;

import com.tree.common.mail.service.IEmailService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @ClassName com.demo.common.mail.service.impl
 * Description: <类功能描述>. <br>
 * <p>
 * <使用说明>
 * </p>
 * @Author tree
 * @Date 2019-05-25 23:51
 * @Version 1.0
 */
@Service
public class EmailService implements IEmailService {
//    private static final Logger logger = LoggerFactory.getLogger(EmailService.class);
//    @Autowired
//    private JavaMailSender mailSender;
//
//    @Value("${mail.from}")
//    private String from;

    @Override
    @Async
    public void sendMail(String[] addresses, String subject, String content) {
//        if(StringUtils.isEmpty(from) || addresses == null || addresses.length == 0 || StringUtils.isEmpty(subject ) || StringUtils.isEmpty(content) ){
//            logger.error(Log.op("sendMail").msg("send mail error").toString());
//        }
//        SimpleMailMessage mailMessage = new SimpleMailMessage();
//        mailMessage.setFrom(from);
//        mailMessage.setSubject(subject);
//        mailMessage.setTo(addresses);
//        mailMessage.setText(content);
//        try {
//            mailSender.send(mailMessage);
//        }catch (MailException e){
//            logger.error(Log.op("sendMail").msg("send mail error").toString());
//
//        }
    }
}
